package com.scau402.system1.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.scau402.system1.domain.po.WmsWarehouseDO;
import com.scau402.system1.domain.vo.StorageVO;
import com.scau402.system1.domain.vo.WmsStorageVO;
import com.scau402.system1.domain.vo.WmsWareStorageVO;
import com.scau402.system1.domain.vo.WmsWarehouseStorageVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 仓库Mapper接口
 *
 * @author ruoyi
 * @date 2023-06-26
 */
public interface WmsWarehouseMapper extends BaseMapper<WmsWarehouseDO> {
    /**
     * 根据id获取仓库名称
     * @param id 仓库id
     * @return
     */
    @Select("select warehouse_name from wms_warehouse where id = #{id}")
    String selectNameById(Long id);

    /**
     * 根据id获取已使用容量大小
     * @param id 仓库id
     * @return
     */
    @Select("select used_cap from wms_warehouse where id = #{id};")
    Long selectUsedCapById(Long id);

    /**
     * 根据查询指定的列
     * @param id 仓库id
     * @return
     */
    @Select("select used_cap from wms_warehouse where id = #{id};")
    Long selectUCById(Long id);
    /**
     * 查询仓库
     *
     * @param id 仓库主键
     * @return 仓库
     */
    public WmsWarehouseDO selectWmsWarehouseById(Long id);

    /**
     * 查询仓库列表
     *
     * @param wmsWarehouseDO 仓库
     * @return 仓库集合
     */
    public List<WmsWarehouseDO> selectWmsWarehouseList(WmsWarehouseDO wmsWarehouseDO);

    /**
     * 新增仓库
     *
     * @param wmsWarehouseDO 仓库
     * @return 结果
     */
    public int insertWmsWarehouse(WmsWarehouseDO wmsWarehouseDO);

    /**
     * 修改仓库
     *
     * @param wmsWarehouseDO 仓库
     * @return 结果
     */
    public int updateWmsWarehouse(WmsWarehouseDO wmsWarehouseDO);

    /**
     * 删除仓库
     *
     * @param id 仓库主键
     * @return 结果
     */
    public int deleteWmsWarehouseById(Long id);

    /**
     * 批量删除仓库
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteWmsWarehouseByIds(Long[] ids);

    public String getMaxCode(Long tenantId);

    public Long selectWmsWarehouseByCode(WmsWarehouseDO warehouse);

    public int checkDefaultExist(Long tenantId);

    public int checkNameExist(WmsWarehouseDO wmsWarehouseDO);

    List<WmsWareStorageVO> getRelationsWare(Long tenantId);

    List<StorageVO> getRelationsStorage(Long warehouseId);

    List<WmsWareStorageVO> getRelWareStorage(Long tenantId);
}
